home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / dep309.zip / DEPARC.EXE / SCRIPTS.EXE / STUDENTS.DSL < prev    next >
Text File  |  1993-10-19  |  2KB  |  45 lines

  1. SCRIPT Students;                 (* This is a simple script to     *)
  2. VAR                              (* demonstrate STRING and INTEGER *)
  3. Age : ARRAY [0..19] OF INTEGER;  (* arrays. It asks for the names  *)
  4. Name : ARRAY [0..19] OF STRING;  (* of up to 20 pupils and their   *)
  5. Count : INTEGER;                 (* ages, and then displays them.  *)
  6. AgeStr : STRING[3];             
  7. Useful : INTEGER;
  8. Round : INTEGER;                 (* V.1.10 for Deputy 3.00 and later *)
  9. BEGIN
  10. ClrScr; 
  11. WrLn('\nType in the names/ages (ENTER a blank to end)');
  12. WrLn('-----------------------------------------------');
  13. Count:=0;
  14.    REPEAT
  15.    WrLn;
  16.    Write('Name of Person No.'); Write(Count+1); Write(': ');
  17.    Read(Name[Count]); 
  18.       IF Name[Count]<>'' THEN
  19.         REPEAT
  20.         Write(' Age of Person No.'); Write(Count+1); Write(': ');
  21.         Read(AgeStr);
  22.         StrToInt(AgeStr,Useful);  
  23.         Age[Count]:=Useful;
  24.            IF (Age[Count]<1) OR (Age[Count]>30) THEN 
  25.            WrLn('Sorry Invalid Age, try again !'); 
  26.            WrLn;
  27.            END;
  28.         UNTIL (Age[Count]>0) AND (Age[Count]<31);
  29.       END;
  30.    INC(Count);
  31.    UNTIL (Name[Count-1]='') OR (Count=19);
  32. DEC(Count,2); 
  33. ClrScr;
  34. WrLn('\nHere are the details of your names:');
  35. WrLn('-----------------------------------\n');
  36.    FOR Round:=0 TO Count DO
  37.    Write('Student No.'); 
  38.    Write(Round+1);
  39.    Write(': '); 
  40.    Write(Name[Round]);
  41.    GotoXY(25,WhereY);
  42.    Write('Age: '); 
  43.    WrLn(Age[Round]); 
  44.    END;
  45. END Students.